package cn.whenpigsfly.rn.apsara;

import androidx.annotation.Nullable;


import com.aliyun.player.IPlayer;
import com.facebook.react.bridge.JSApplicationIllegalArgumentException;


public class VideoResizeMode {
    public static IPlayer.ScaleMode toScaleType(@Nullable String resizeModeValue){
        if ("contain".equals(resizeModeValue)) {
            return IPlayer.ScaleMode.SCALE_ASPECT_FIT;
        }
        if ("cover".equals(resizeModeValue)) {
            return IPlayer.ScaleMode.SCALE_ASPECT_FILL;
        }
        if ("stretch".equals(resizeModeValue)) {
            return IPlayer.ScaleMode.SCALE_TO_FILL;
        }
        throw new JSApplicationIllegalArgumentException(
                "Invalid resize mode: '" + resizeModeValue + "'");
    }
}
